/***********************************************************************************************************************
*
* Freescale Semiconductor Inc.
* (c) Copyright 2006-2009 Freescale Semiconductor, Inc.
* ALL RIGHTS RESERVED.
*
*********************************************************************************************************************//*!
*
* @file   TSS_SensorTSI.h
*
* @brief  Functions Prototypes, constants, variables and macros for the sensing of electrodes
*
* @version 1.0.44.0
*
* @date Sep-12-2012
*
*
***********************************************************************************************************************/

#ifndef TSS_SENSORTSI_H
  #define TSS_SENSORTSI_H

  #include "TSS_Sensor.h"

  /***************************** Types ***************************/

  #if TSS_HCS08_MCU || TSS_CFV1_MCU

    /* Electrode Data */
    typedef struct {
      const UINT8 tsi_cu8ModuleID;
    } TSS_TSI_ELECTRODE_ROMDATA;

    typedef struct {
      UINT8 u8Dummy;
    } TSS_TSI_ELECTRODE_RAMDATA;

  #elif TSS_KINETIS_MCU || TSS_CFM_MCU

    typedef enum
    {
      TSI_EOSF_STATE_NONE    = 0,
      TSI_EOSF_STATE_REGULAR = 1,
      TSI_EOSF_STATE_EXCESS  = 2,
      TSI_EOSF_STATE_ERROR   = 3,
      TSI_EOSF_STATE_PROCESS = 4
    } TSS_TSI_EOSF_STATES;      
    
    /* Method Data */
    typedef struct {
      const TSS_METHOD_CONTROL tsi_fMethodControl;
      const UINT32 * const tsi_cpsu32Module;
      const UINT8 tsi_u8ModuleIRQNum;
      const UINT8 tsi_u8TriggerSource;
      const UINT8 tsi_u8LowPowerControlSource;
    } TSS_TSI_METHOD_ROMDATA;

    typedef struct {
      volatile TSS_TSI_EOSF_STATES tsi_eEndOfScanState;
      UINT16 tsi_au16Resolution;
    } TSS_TSI_METHOD_RAMDATA;

    /* Electrode Data */
    typedef struct {
      const TSS_TSI_METHOD_ROMDATA * const tsi_cpsu32MethodROMData;
      const TSS_TSI_METHOD_RAMDATA volatile * tsi_u8MethodRAMData;
      const UINT32 tsi_cu32ChannelNum;
    } TSS_TSI_ELECTRODE_ROMDATA;

    typedef struct {
      UINT8 u8Dummy;
    } TSS_TSI_ELECTRODE_RAMDATA;
    
#if (TSS_TSI_VERSION==1)
    typedef struct {
      UINT32 GENCS;
	  UINT32 SCANC;
	  UINT32 PEN;
	  UINT32 STATUS;
	  UINT8 RESERVED_0[240];
      UINT16 tsi_u16Counter[16];
      UINT32 THRESHOLD[16];
    } volatile * TSS_TSI_MemMapPtr;
#elif (TSS_TSI_VERSION==2)
    typedef struct{
      UINT32 GENCS;
      UINT32 SCANC;
      UINT32 PEN;
      UINT32 WUCNTR;
	  UINT8 RESERVED_0[240];
      UINT16  tsi_u16Counter[16];
      UINT32 THRESHOLD;
    } volatile * TSS_TSI_MemMapPtr;
#elif (TSS_TSI_VERSION==3)
    typedef struct {
      uint32_t GENCS;                                  /**< General Control and Status Register, offset: 0x0 */
      uint32_t SCANC;                                  /**< SCAN Control Register, offset: 0x4 */
      uint32_t PEN;                                    /**< Pin Enable Register, offset: 0x8 */
      uint8_t RESERVED_0[244];
      UINT16 tsi_u16Counter[16];                                /**< Counter Register, array offset: 0x100, array step: 0x4 */
      uint32_t THRESHOLD;                              /**< Low Power Channel Threshold Register, offset: 0x120 */
    } volatile * TSS_TSI_MemMapPtr; 
#endif
    
  #else /* End of TSS_KINETIS_MCU || TSS_CFM_MCU */
    #error "TSS - Not supported MCU used"
  #endif

  /************************ Function prototypes *********************/

  extern UINT8 TSI_SensorInit(UINT8 u8Command);
  /*
  function:   TSI_SensorInit
  brief:      Initializes modules for the sensing of the electrodes.
  param:      Command to be performed                           
  return:     Status code                              
  */
    
  extern UINT8 TSI_SampleElectrode(UINT8 u8ElecNum, UINT8 u8Command);
  /*
  function:   TSI_SampleElectrode
  brief:      Performs a valid reading of one electrode, and returns a status code
  param:      u8ElecNum - Number of electrode to be scanned
              u8Command - Measurement command
  return:     Status code
  */

  /*********************************************************************************
  *    Determination if TSI method is used for later conditional TSI module 
  *    initialization
  *********************************************************************************/

  #define TSS_TSI_USED           (TSS_DETECT_EL_MODULE(0,TSI) || TSS_DETECT_EL_MODULE(1,TSI) || TSS_DETECT_EL_MODULE(2,TSI) || TSS_DETECT_EL_MODULE(3,TSI) || TSS_DETECT_EL_MODULE(4,TSI) || TSS_DETECT_EL_MODULE(5,TSI) || TSS_DETECT_EL_MODULE(6,TSI) || TSS_DETECT_EL_MODULE(7,TSI) || TSS_DETECT_EL_MODULE(8,TSI) || TSS_DETECT_EL_MODULE(9,TSI) || TSS_DETECT_EL_MODULE(10,TSI) || TSS_DETECT_EL_MODULE(11,TSI) || TSS_DETECT_EL_MODULE(12,TSI) || TSS_DETECT_EL_MODULE(13,TSI) || TSS_DETECT_EL_MODULE(14,TSI) || TSS_DETECT_EL_MODULE(15,TSI) || TSS_DETECT_EL_MODULE(16,TSI) || TSS_DETECT_EL_MODULE(17,TSI) || TSS_DETECT_EL_MODULE(18,TSI) || TSS_DETECT_EL_MODULE(19,TSI) || TSS_DETECT_EL_MODULE(20,TSI) || TSS_DETECT_EL_MODULE(21,TSI) || TSS_DETECT_EL_MODULE(22,TSI) || TSS_DETECT_EL_MODULE(23,TSI) || TSS_DETECT_EL_MODULE(24,TSI) || TSS_DETECT_EL_MODULE(25,TSI) || TSS_DETECT_EL_MODULE(26,TSI) || TSS_DETECT_EL_MODULE(27,TSI) || TSS_DETECT_EL_MODULE(28,TSI) || TSS_DETECT_EL_MODULE(29,TSI) || TSS_DETECT_EL_MODULE(30,TSI) || TSS_DETECT_EL_MODULE(31,TSI) || TSS_DETECT_EL_MODULE(32,TSI) || TSS_DETECT_EL_MODULE(33,TSI) || TSS_DETECT_EL_MODULE(34,TSI) || TSS_DETECT_EL_MODULE(35,TSI) || TSS_DETECT_EL_MODULE(36,TSI) || TSS_DETECT_EL_MODULE(37,TSI) || TSS_DETECT_EL_MODULE(38,TSI) || TSS_DETECT_EL_MODULE(39,TSI) || TSS_DETECT_EL_MODULE(40,TSI) || TSS_DETECT_EL_MODULE(41,TSI) || TSS_DETECT_EL_MODULE(42,TSI) || TSS_DETECT_EL_MODULE(43,TSI) || TSS_DETECT_EL_MODULE(44,TSI) || TSS_DETECT_EL_MODULE(45,TSI) || TSS_DETECT_EL_MODULE(46,TSI) || TSS_DETECT_EL_MODULE(47,TSI) || TSS_DETECT_EL_MODULE(48,TSI) || TSS_DETECT_EL_MODULE(49,TSI) || TSS_DETECT_EL_MODULE(50,TSI) || TSS_DETECT_EL_MODULE(51,TSI) || TSS_DETECT_EL_MODULE(52,TSI) || TSS_DETECT_EL_MODULE(53,TSI) || TSS_DETECT_EL_MODULE(54,TSI) || TSS_DETECT_EL_MODULE(55,TSI) || TSS_DETECT_EL_MODULE(56,TSI) || TSS_DETECT_EL_MODULE(57,TSI) || TSS_DETECT_EL_MODULE(58,TSI) || TSS_DETECT_EL_MODULE(59,TSI) || TSS_DETECT_EL_MODULE(60,TSI) || TSS_DETECT_EL_MODULE(61,TSI) || TSS_DETECT_EL_MODULE(62,TSI) || TSS_DETECT_EL_MODULE(63,TSI))
  #define TSS_TSI0_USED          (TSS_DETECT_EL_MODULE(0,TSI0) || TSS_DETECT_EL_MODULE(1,TSI0) || TSS_DETECT_EL_MODULE(2,TSI0) || TSS_DETECT_EL_MODULE(3,TSI0) || TSS_DETECT_EL_MODULE(4,TSI0) || TSS_DETECT_EL_MODULE(5,TSI0) || TSS_DETECT_EL_MODULE(6,TSI0) || TSS_DETECT_EL_MODULE(7,TSI0) || TSS_DETECT_EL_MODULE(8,TSI0) || TSS_DETECT_EL_MODULE(9,TSI0) || TSS_DETECT_EL_MODULE(10,TSI0) || TSS_DETECT_EL_MODULE(11,TSI0) || TSS_DETECT_EL_MODULE(12,TSI0) || TSS_DETECT_EL_MODULE(13,TSI0) || TSS_DETECT_EL_MODULE(14,TSI0) || TSS_DETECT_EL_MODULE(15,TSI0) || TSS_DETECT_EL_MODULE(16,TSI0) || TSS_DETECT_EL_MODULE(17,TSI0) || TSS_DETECT_EL_MODULE(18,TSI0) || TSS_DETECT_EL_MODULE(19,TSI0) || TSS_DETECT_EL_MODULE(20,TSI0) || TSS_DETECT_EL_MODULE(21,TSI0) || TSS_DETECT_EL_MODULE(22,TSI0) || TSS_DETECT_EL_MODULE(23,TSI0) || TSS_DETECT_EL_MODULE(24,TSI0) || TSS_DETECT_EL_MODULE(25,TSI0) || TSS_DETECT_EL_MODULE(26,TSI0) || TSS_DETECT_EL_MODULE(27,TSI0) || TSS_DETECT_EL_MODULE(28,TSI0) || TSS_DETECT_EL_MODULE(29,TSI0) || TSS_DETECT_EL_MODULE(30,TSI0) || TSS_DETECT_EL_MODULE(31,TSI0) || TSS_DETECT_EL_MODULE(32,TSI0) || TSS_DETECT_EL_MODULE(33,TSI0) || TSS_DETECT_EL_MODULE(34,TSI0) || TSS_DETECT_EL_MODULE(35,TSI0) || TSS_DETECT_EL_MODULE(36,TSI0) || TSS_DETECT_EL_MODULE(37,TSI0) || TSS_DETECT_EL_MODULE(38,TSI0) || TSS_DETECT_EL_MODULE(39,TSI0) || TSS_DETECT_EL_MODULE(40,TSI0) || TSS_DETECT_EL_MODULE(41,TSI0) || TSS_DETECT_EL_MODULE(42,TSI0) || TSS_DETECT_EL_MODULE(43,TSI0) || TSS_DETECT_EL_MODULE(44,TSI0) || TSS_DETECT_EL_MODULE(45,TSI0) || TSS_DETECT_EL_MODULE(46,TSI0) || TSS_DETECT_EL_MODULE(47,TSI0) || TSS_DETECT_EL_MODULE(48,TSI0) || TSS_DETECT_EL_MODULE(49,TSI0) || TSS_DETECT_EL_MODULE(50,TSI0) || TSS_DETECT_EL_MODULE(51,TSI0) || TSS_DETECT_EL_MODULE(52,TSI0) || TSS_DETECT_EL_MODULE(53,TSI0) || TSS_DETECT_EL_MODULE(54,TSI0) || TSS_DETECT_EL_MODULE(55,TSI0) || TSS_DETECT_EL_MODULE(56,TSI0) || TSS_DETECT_EL_MODULE(57,TSI0) || TSS_DETECT_EL_MODULE(58,TSI0) || TSS_DETECT_EL_MODULE(59,TSI0) || TSS_DETECT_EL_MODULE(60,TSI0) || TSS_DETECT_EL_MODULE(61,TSI0) || TSS_DETECT_EL_MODULE(62,TSI0) || TSS_DETECT_EL_MODULE(63,TSI0))
  #define TSS_TSI1_USED          (TSS_DETECT_EL_MODULE(0,TSI1) || TSS_DETECT_EL_MODULE(1,TSI1) || TSS_DETECT_EL_MODULE(2,TSI1) || TSS_DETECT_EL_MODULE(3,TSI1) || TSS_DETECT_EL_MODULE(4,TSI1) || TSS_DETECT_EL_MODULE(5,TSI1) || TSS_DETECT_EL_MODULE(6,TSI1) || TSS_DETECT_EL_MODULE(7,TSI1) || TSS_DETECT_EL_MODULE(8,TSI1) || TSS_DETECT_EL_MODULE(9,TSI1) || TSS_DETECT_EL_MODULE(10,TSI1) || TSS_DETECT_EL_MODULE(11,TSI1) || TSS_DETECT_EL_MODULE(12,TSI1) || TSS_DETECT_EL_MODULE(13,TSI1) || TSS_DETECT_EL_MODULE(14,TSI1) || TSS_DETECT_EL_MODULE(15,TSI1) || TSS_DETECT_EL_MODULE(16,TSI1) || TSS_DETECT_EL_MODULE(17,TSI1) || TSS_DETECT_EL_MODULE(18,TSI1) || TSS_DETECT_EL_MODULE(19,TSI1) || TSS_DETECT_EL_MODULE(20,TSI1) || TSS_DETECT_EL_MODULE(21,TSI1) || TSS_DETECT_EL_MODULE(22,TSI1) || TSS_DETECT_EL_MODULE(23,TSI1) || TSS_DETECT_EL_MODULE(24,TSI1) || TSS_DETECT_EL_MODULE(25,TSI1) || TSS_DETECT_EL_MODULE(26,TSI1) || TSS_DETECT_EL_MODULE(27,TSI1) || TSS_DETECT_EL_MODULE(28,TSI1) || TSS_DETECT_EL_MODULE(29,TSI1) || TSS_DETECT_EL_MODULE(30,TSI1) || TSS_DETECT_EL_MODULE(31,TSI1) || TSS_DETECT_EL_MODULE(32,TSI1) || TSS_DETECT_EL_MODULE(33,TSI1) || TSS_DETECT_EL_MODULE(34,TSI1) || TSS_DETECT_EL_MODULE(35,TSI1) || TSS_DETECT_EL_MODULE(36,TSI1) || TSS_DETECT_EL_MODULE(37,TSI1) || TSS_DETECT_EL_MODULE(38,TSI1) || TSS_DETECT_EL_MODULE(39,TSI1) || TSS_DETECT_EL_MODULE(40,TSI1) || TSS_DETECT_EL_MODULE(41,TSI1) || TSS_DETECT_EL_MODULE(42,TSI1) || TSS_DETECT_EL_MODULE(43,TSI1) || TSS_DETECT_EL_MODULE(44,TSI1) || TSS_DETECT_EL_MODULE(45,TSI1) || TSS_DETECT_EL_MODULE(46,TSI1) || TSS_DETECT_EL_MODULE(47,TSI1) || TSS_DETECT_EL_MODULE(48,TSI1) || TSS_DETECT_EL_MODULE(49,TSI1) || TSS_DETECT_EL_MODULE(50,TSI1) || TSS_DETECT_EL_MODULE(51,TSI1) || TSS_DETECT_EL_MODULE(52,TSI1) || TSS_DETECT_EL_MODULE(53,TSI1) || TSS_DETECT_EL_MODULE(54,TSI1) || TSS_DETECT_EL_MODULE(55,TSI1) || TSS_DETECT_EL_MODULE(56,TSI1) || TSS_DETECT_EL_MODULE(57,TSI1) || TSS_DETECT_EL_MODULE(58,TSI1) || TSS_DETECT_EL_MODULE(59,TSI1) || TSS_DETECT_EL_MODULE(60,TSI1) || TSS_DETECT_EL_MODULE(61,TSI1) || TSS_DETECT_EL_MODULE(62,TSI1) || TSS_DETECT_EL_MODULE(63,TSI1))

  #define TSS_TSI_METHOD_USED    (TSS_DETECT_EL_METHOD(0,TSI) || TSS_DETECT_EL_METHOD(1,TSI) || TSS_DETECT_EL_METHOD(2,TSI) || TSS_DETECT_EL_METHOD(3,TSI) || TSS_DETECT_EL_METHOD(4,TSI) || TSS_DETECT_EL_METHOD(5,TSI) || TSS_DETECT_EL_METHOD(6,TSI) || TSS_DETECT_EL_METHOD(7,TSI) || TSS_DETECT_EL_METHOD(8,TSI) || TSS_DETECT_EL_METHOD(9,TSI) || TSS_DETECT_EL_METHOD(10,TSI) || TSS_DETECT_EL_METHOD(11,TSI) || TSS_DETECT_EL_METHOD(12,TSI) || TSS_DETECT_EL_METHOD(13,TSI) || TSS_DETECT_EL_METHOD(14,TSI) || TSS_DETECT_EL_METHOD(15,TSI) || TSS_DETECT_EL_METHOD(16,TSI) || TSS_DETECT_EL_METHOD(17,TSI) || TSS_DETECT_EL_METHOD(18,TSI) || TSS_DETECT_EL_METHOD(19,TSI) || TSS_DETECT_EL_METHOD(20,TSI) || TSS_DETECT_EL_METHOD(21,TSI) || TSS_DETECT_EL_METHOD(22,TSI) || TSS_DETECT_EL_METHOD(23,TSI) || TSS_DETECT_EL_METHOD(24,TSI) || TSS_DETECT_EL_METHOD(25,TSI) || TSS_DETECT_EL_METHOD(26,TSI) || TSS_DETECT_EL_METHOD(27,TSI) || TSS_DETECT_EL_METHOD(28,TSI) || TSS_DETECT_EL_METHOD(29,TSI) || TSS_DETECT_EL_METHOD(30,TSI) || TSS_DETECT_EL_METHOD(31,TSI) || TSS_DETECT_EL_METHOD(32,TSI) || TSS_DETECT_EL_METHOD(33,TSI) || TSS_DETECT_EL_METHOD(34,TSI) || TSS_DETECT_EL_METHOD(35,TSI) || TSS_DETECT_EL_METHOD(36,TSI) || TSS_DETECT_EL_METHOD(37,TSI) || TSS_DETECT_EL_METHOD(38,TSI) || TSS_DETECT_EL_METHOD(39,TSI) || TSS_DETECT_EL_METHOD(40,TSI) || TSS_DETECT_EL_METHOD(41,TSI) || TSS_DETECT_EL_METHOD(42,TSI) || TSS_DETECT_EL_METHOD(43,TSI) || TSS_DETECT_EL_METHOD(44,TSI) || TSS_DETECT_EL_METHOD(45,TSI) || TSS_DETECT_EL_METHOD(46,TSI) || TSS_DETECT_EL_METHOD(47,TSI) || TSS_DETECT_EL_METHOD(48,TSI) || TSS_DETECT_EL_METHOD(49,TSI) || TSS_DETECT_EL_METHOD(50,TSI) || TSS_DETECT_EL_METHOD(51,TSI) || TSS_DETECT_EL_METHOD(52,TSI) || TSS_DETECT_EL_METHOD(53,TSI) || TSS_DETECT_EL_METHOD(54,TSI) || TSS_DETECT_EL_METHOD(55,TSI) || TSS_DETECT_EL_METHOD(56,TSI) || TSS_DETECT_EL_METHOD(57,TSI) || TSS_DETECT_EL_METHOD(58,TSI) || TSS_DETECT_EL_METHOD(59,TSI) || TSS_DETECT_EL_METHOD(60,TSI) || TSS_DETECT_EL_METHOD(61,TSI) || TSS_DETECT_EL_METHOD(62,TSI) || TSS_DETECT_EL_METHOD(63,TSI))

  /****************** ROM & RAM Data prototypes ******************/

  #if TSS_N_ELECTRODES > 0
    #if (TSS_DETECT_EL_METHOD(0,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E0_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E0_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 1
    #if (TSS_DETECT_EL_METHOD(1,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E1_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E1_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 2
    #if (TSS_DETECT_EL_METHOD(2,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E2_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E2_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 3
    #if (TSS_DETECT_EL_METHOD(3,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E3_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E3_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 4
    #if (TSS_DETECT_EL_METHOD(4,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E4_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E4_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 5
    #if (TSS_DETECT_EL_METHOD(5,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E5_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E5_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 6
    #if (TSS_DETECT_EL_METHOD(6,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E6_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E6_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 7
    #if (TSS_DETECT_EL_METHOD(7,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E7_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E7_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 8
    #if (TSS_DETECT_EL_METHOD(8,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E8_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E8_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 9
    #if (TSS_DETECT_EL_METHOD(9,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E9_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E9_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 10
    #if (TSS_DETECT_EL_METHOD(10,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E10_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E10_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 11
    #if (TSS_DETECT_EL_METHOD(11,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E11_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E11_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 12
    #if (TSS_DETECT_EL_METHOD(12,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E12_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E12_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 13
    #if (TSS_DETECT_EL_METHOD(13,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E13_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E13_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 14
    #if (TSS_DETECT_EL_METHOD(14,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E14_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E14_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 15
    #if (TSS_DETECT_EL_METHOD(15,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E15_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E15_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 16
    #if (TSS_DETECT_EL_METHOD(16,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E16_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E16_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 17
    #if (TSS_DETECT_EL_METHOD(17,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E17_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E17_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 18
    #if (TSS_DETECT_EL_METHOD(18,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E18_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E18_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 19
    #if (TSS_DETECT_EL_METHOD(19,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E19_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E19_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 20
    #if (TSS_DETECT_EL_METHOD(20,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E20_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E20_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 21
    #if (TSS_DETECT_EL_METHOD(21,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E21_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E21_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 22
    #if (TSS_DETECT_EL_METHOD(22,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E22_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E22_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 23
    #if (TSS_DETECT_EL_METHOD(23,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E23_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E23_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 24
    #if (TSS_DETECT_EL_METHOD(24,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E24_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E24_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 25
    #if (TSS_DETECT_EL_METHOD(25,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E25_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E25_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 26
    #if (TSS_DETECT_EL_METHOD(26,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E26_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E26_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 27
    #if (TSS_DETECT_EL_METHOD(27,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E27_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E27_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 28
    #if (TSS_DETECT_EL_METHOD(28,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E28_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E28_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 29
    #if (TSS_DETECT_EL_METHOD(29,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E29_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E29_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 30
    #if (TSS_DETECT_EL_METHOD(30,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E30_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E30_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 31
    #if (TSS_DETECT_EL_METHOD(31,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E31_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E31_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 32
    #if (TSS_DETECT_EL_METHOD(32,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E32_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E32_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 33
    #if (TSS_DETECT_EL_METHOD(33,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E33_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E33_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 34
    #if (TSS_DETECT_EL_METHOD(34,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E34_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E34_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 35
    #if (TSS_DETECT_EL_METHOD(35,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E35_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E35_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 36
    #if (TSS_DETECT_EL_METHOD(36,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E36_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E36_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 37
    #if (TSS_DETECT_EL_METHOD(37,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E37_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E37_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 38
    #if (TSS_DETECT_EL_METHOD(38,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E38_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E38_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 39
    #if (TSS_DETECT_EL_METHOD(39,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E39_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E39_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 40
    #if (TSS_DETECT_EL_METHOD(40,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E40_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E40_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 41
    #if (TSS_DETECT_EL_METHOD(41,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E41_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E41_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 42
    #if (TSS_DETECT_EL_METHOD(42,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E42_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E42_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 43
    #if (TSS_DETECT_EL_METHOD(43,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E43_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E43_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 44
    #if (TSS_DETECT_EL_METHOD(44,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E44_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E44_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 45
    #if (TSS_DETECT_EL_METHOD(45,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E45_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E45_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 46
    #if (TSS_DETECT_EL_METHOD(46,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E46_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E46_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 47
    #if (TSS_DETECT_EL_METHOD(47,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E47_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E47_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 48
    #if (TSS_DETECT_EL_METHOD(48,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E48_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E48_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 49
    #if (TSS_DETECT_EL_METHOD(49,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E49_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E49_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 50
    #if (TSS_DETECT_EL_METHOD(50,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E50_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E50_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 51
    #if (TSS_DETECT_EL_METHOD(51,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E51_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E51_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 52
    #if (TSS_DETECT_EL_METHOD(52,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E52_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E52_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 53
    #if (TSS_DETECT_EL_METHOD(53,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E53_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E53_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 54
    #if (TSS_DETECT_EL_METHOD(54,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E54_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E54_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 55
    #if (TSS_DETECT_EL_METHOD(55,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E55_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E55_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 56
    #if (TSS_DETECT_EL_METHOD(56,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E56_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E56_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 57
    #if (TSS_DETECT_EL_METHOD(57,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E57_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E57_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 58
    #if (TSS_DETECT_EL_METHOD(58,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E58_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E58_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 59
    #if (TSS_DETECT_EL_METHOD(59,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E59_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E59_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 60
    #if (TSS_DETECT_EL_METHOD(60,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E60_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E60_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 61
    #if (TSS_DETECT_EL_METHOD(61,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E61_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E61_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 62
    #if (TSS_DETECT_EL_METHOD(62,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E62_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E62_RAMDATA_CONTEXT;
    #endif
  #endif

  #if TSS_N_ELECTRODES > 63
    #if (TSS_DETECT_EL_METHOD(63,TSI))
      extern const TSS_TSI_ELECTRODE_ROMDATA TSS_E63_ROMDATA_CONTEXT;
      extern       TSS_TSI_ELECTRODE_RAMDATA TSS_E63_RAMDATA_CONTEXT;
    #endif
  #endif

  /*******************************************************
  ******        Determine what is needed             *****
  *******************************************************/

  #if TSS_DETECT_METHOD(TSI)
    /* HW Timer */
    #ifndef TSS_HW_TIMER_USED
      #define TSS_HW_TIMER_USED      0
    #endif
    /* GPIO */
    #ifndef TSS_HW_GPIO_USED
      #define TSS_HW_GPIO_USED       0
    #endif
  #endif

  /*
  * Handler Body of the measurement method
  */

  /* Low Routine body */
      
  #if TSS_HCS08_MCU || TSS_CFV1_MCU
    #define  TSS_TSI_SAMPLE_ELECTRODE_LOW(el)    ;     /* Nothing */
  #elif TSS_KINETIS_MCU || TSS_CFM_MCU
    #define  TSS_TSI_SAMPLE_ELECTRODE_LOW(el)    ;     /* Nothing */
  #else /* End of TSS_KINETIS_MCU || TSS_CFM_MCU */
    #error "TSS - Not supported MCU used"
  #endif

  /*********** Sample Electrode Low Level Routine assignment *******/

  #if TSS_N_ELECTRODES > 0
    #if (TSS_DETECT_EL_METHOD(0,TSI))
      #define TSS_E0_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(0)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 1
    #if (TSS_DETECT_EL_METHOD(1,TSI))
      #define TSS_E1_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(1)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 2
    #if (TSS_DETECT_EL_METHOD(2,TSI))
      #define TSS_E2_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(2)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 3
    #if (TSS_DETECT_EL_METHOD(3,TSI))
      #define TSS_E3_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(3)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 4
    #if (TSS_DETECT_EL_METHOD(4,TSI))
      #define TSS_E4_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(4)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 5
    #if (TSS_DETECT_EL_METHOD(5,TSI))
      #define TSS_E5_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(5)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 6
    #if (TSS_DETECT_EL_METHOD(6,TSI))
      #define TSS_E6_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(6)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 7
    #if (TSS_DETECT_EL_METHOD(7,TSI))
      #define TSS_E7_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(7)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 8
    #if (TSS_DETECT_EL_METHOD(8,TSI))
      #define TSS_E8_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(8)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 9
    #if (TSS_DETECT_EL_METHOD(9,TSI))
      #define TSS_E9_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(9)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 10
    #if (TSS_DETECT_EL_METHOD(10,TSI))
      #define TSS_E10_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(10)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 11
    #if (TSS_DETECT_EL_METHOD(11,TSI))
      #define TSS_E11_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(11)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 12
    #if (TSS_DETECT_EL_METHOD(12,TSI))
      #define TSS_E12_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(12)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 13
    #if (TSS_DETECT_EL_METHOD(13,TSI))
      #define TSS_E13_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(13)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 14
    #if (TSS_DETECT_EL_METHOD(14,TSI))
      #define TSS_E14_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(14)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 15
    #if (TSS_DETECT_EL_METHOD(15,TSI))
      #define TSS_E15_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(15)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 16
    #if (TSS_DETECT_EL_METHOD(16,TSI))
      #define TSS_E16_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(16)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 17
    #if (TSS_DETECT_EL_METHOD(17,TSI))
      #define TSS_E17_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(17)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 18
    #if (TSS_DETECT_EL_METHOD(18,TSI))
      #define TSS_E18_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(18)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 19
    #if (TSS_DETECT_EL_METHOD(19,TSI))
      #define TSS_E19_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(19)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 20
    #if (TSS_DETECT_EL_METHOD(20,TSI))
      #define TSS_E20_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(20)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 21
    #if (TSS_DETECT_EL_METHOD(21,TSI))
      #define TSS_E21_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(21)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 22
    #if (TSS_DETECT_EL_METHOD(22,TSI))
      #define TSS_E22_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(22)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 23
    #if (TSS_DETECT_EL_METHOD(23,TSI))
      #define TSS_E23_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(23)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 24
    #if (TSS_DETECT_EL_METHOD(24,TSI))
      #define TSS_E24_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(24)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 25
    #if (TSS_DETECT_EL_METHOD(25,TSI))
      #define TSS_E25_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(25)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 26
    #if (TSS_DETECT_EL_METHOD(26,TSI))
      #define TSS_E26_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(26)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 27
    #if (TSS_DETECT_EL_METHOD(27,TSI))
      #define TSS_E27_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(27)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 28
    #if (TSS_DETECT_EL_METHOD(28,TSI))
      #define TSS_E28_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(28)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 29
    #if (TSS_DETECT_EL_METHOD(29,TSI))
      #define TSS_E29_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(29)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 30
    #if (TSS_DETECT_EL_METHOD(30,TSI))
      #define TSS_E30_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(30)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 31
    #if (TSS_DETECT_EL_METHOD(31,TSI))
      #define TSS_E31_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(31)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 32
    #if (TSS_DETECT_EL_METHOD(32,TSI))
      #define TSS_E32_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(32)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 33
    #if (TSS_DETECT_EL_METHOD(33,TSI))
      #define TSS_E33_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(33)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 34
    #if (TSS_DETECT_EL_METHOD(34,TSI))
      #define TSS_E34_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(34)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 35
    #if (TSS_DETECT_EL_METHOD(35,TSI))
      #define TSS_E35_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(35)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 36
    #if (TSS_DETECT_EL_METHOD(36,TSI))
      #define TSS_E36_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(36)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 37
    #if (TSS_DETECT_EL_METHOD(37,TSI))
      #define TSS_E37_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(37)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 38
    #if (TSS_DETECT_EL_METHOD(38,TSI))
      #define TSS_E38_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(38)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 39
    #if (TSS_DETECT_EL_METHOD(39,TSI))
      #define TSS_E39_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(39)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 40
    #if (TSS_DETECT_EL_METHOD(40,TSI))
      #define TSS_E40_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(40)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 41
    #if (TSS_DETECT_EL_METHOD(41,TSI))
      #define TSS_E41_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(41)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 42
    #if (TSS_DETECT_EL_METHOD(42,TSI))
      #define TSS_E42_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(42)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 43
    #if (TSS_DETECT_EL_METHOD(43,TSI))
      #define TSS_E43_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(43)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 44
    #if (TSS_DETECT_EL_METHOD(44,TSI))
      #define TSS_E44_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(44)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 45
    #if (TSS_DETECT_EL_METHOD(45,TSI))
      #define TSS_E45_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(45)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 46
    #if (TSS_DETECT_EL_METHOD(46,TSI))
      #define TSS_E46_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(46)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 47
    #if (TSS_DETECT_EL_METHOD(47,TSI))
      #define TSS_E47_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(47)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 48
    #if (TSS_DETECT_EL_METHOD(48,TSI))
      #define TSS_E48_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(48)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 49
    #if (TSS_DETECT_EL_METHOD(49,TSI))
      #define TSS_E49_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(49)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 50
    #if (TSS_DETECT_EL_METHOD(50,TSI))
      #define TSS_E50_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(50)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 51
    #if (TSS_DETECT_EL_METHOD(51,TSI))
      #define TSS_E51_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(51)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 52
    #if (TSS_DETECT_EL_METHOD(52,TSI))
      #define TSS_E52_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(52)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 53
    #if (TSS_DETECT_EL_METHOD(53,TSI))
      #define TSS_E53_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(53)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 54
    #if (TSS_DETECT_EL_METHOD(54,TSI))
      #define TSS_E54_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(54)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 55
    #if (TSS_DETECT_EL_METHOD(55,TSI))
      #define TSS_E55_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(55)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 56
    #if (TSS_DETECT_EL_METHOD(56,TSI))
      #define TSS_E56_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(56)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 57
    #if (TSS_DETECT_EL_METHOD(57,TSI))
      #define TSS_E57_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(57)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 58
    #if (TSS_DETECT_EL_METHOD(58,TSI))
      #define TSS_E58_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(58)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 59
    #if (TSS_DETECT_EL_METHOD(59,TSI))
      #define TSS_E59_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(59)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 60
    #if (TSS_DETECT_EL_METHOD(60,TSI))
      #define TSS_E60_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(60)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 61
    #if (TSS_DETECT_EL_METHOD(61,TSI))
      #define TSS_E61_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(61)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 62
    #if (TSS_DETECT_EL_METHOD(62,TSI))
      #define TSS_E62_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(62)
    #endif
  #endif
  #if TSS_N_ELECTRODES > 63
    #if (TSS_DETECT_EL_METHOD(63,TSI))
      #define TSS_E63_SAMPLE_ELECTRODE_LOW()   TSS_TSI_SAMPLE_ELECTRODE_LOW(63)
    #endif
  #endif

  /*************** Sample Electrode Routine assignment *************/

  #if TSS_N_ELECTRODES > 0
    #if (TSS_DETECT_EL_METHOD(0,TSI))
      #define TSS_E0_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 1
    #if (TSS_DETECT_EL_METHOD(1,TSI))
      #define TSS_E1_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 2
    #if (TSS_DETECT_EL_METHOD(2,TSI))
      #define TSS_E2_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 3
    #if (TSS_DETECT_EL_METHOD(3,TSI))
      #define TSS_E3_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 4
    #if (TSS_DETECT_EL_METHOD(4,TSI))
      #define TSS_E4_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 5
    #if (TSS_DETECT_EL_METHOD(5,TSI))
      #define TSS_E5_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 6
    #if (TSS_DETECT_EL_METHOD(6,TSI))
      #define TSS_E6_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 7
    #if (TSS_DETECT_EL_METHOD(7,TSI))
      #define TSS_E7_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 8
    #if (TSS_DETECT_EL_METHOD(8,TSI))
      #define TSS_E8_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 9
    #if (TSS_DETECT_EL_METHOD(9,TSI))
      #define TSS_E9_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 10
    #if (TSS_DETECT_EL_METHOD(10,TSI))
      #define TSS_E10_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 11
    #if (TSS_DETECT_EL_METHOD(11,TSI))
      #define TSS_E11_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 12
    #if (TSS_DETECT_EL_METHOD(12,TSI))
      #define TSS_E12_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 13
    #if (TSS_DETECT_EL_METHOD(13,TSI))
      #define TSS_E13_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 14
    #if (TSS_DETECT_EL_METHOD(14,TSI))
      #define TSS_E14_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 15
    #if (TSS_DETECT_EL_METHOD(15,TSI))
      #define TSS_E15_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 16
    #if (TSS_DETECT_EL_METHOD(16,TSI))
      #define TSS_E16_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 17
    #if (TSS_DETECT_EL_METHOD(17,TSI))
      #define TSS_E17_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 18
    #if (TSS_DETECT_EL_METHOD(18,TSI))
      #define TSS_E18_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 19
    #if (TSS_DETECT_EL_METHOD(19,TSI))
      #define TSS_E19_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 20
    #if (TSS_DETECT_EL_METHOD(20,TSI))
      #define TSS_E20_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 21
    #if (TSS_DETECT_EL_METHOD(21,TSI))
      #define TSS_E21_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 22
    #if (TSS_DETECT_EL_METHOD(22,TSI))
      #define TSS_E22_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 23
    #if (TSS_DETECT_EL_METHOD(23,TSI))
      #define TSS_E23_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 24
    #if (TSS_DETECT_EL_METHOD(24,TSI))
      #define TSS_E24_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 25
    #if (TSS_DETECT_EL_METHOD(25,TSI))
      #define TSS_E25_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 26
    #if (TSS_DETECT_EL_METHOD(26,TSI))
      #define TSS_E26_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 27
    #if (TSS_DETECT_EL_METHOD(27,TSI))
      #define TSS_E27_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 28
    #if (TSS_DETECT_EL_METHOD(28,TSI))
      #define TSS_E28_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 29
    #if (TSS_DETECT_EL_METHOD(29,TSI))
      #define TSS_E29_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 30
    #if (TSS_DETECT_EL_METHOD(30,TSI))
      #define TSS_E30_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 31
    #if (TSS_DETECT_EL_METHOD(31,TSI))
      #define TSS_E31_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 32
    #if (TSS_DETECT_EL_METHOD(32,TSI))
      #define TSS_E32_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 33
    #if (TSS_DETECT_EL_METHOD(33,TSI))
      #define TSS_E33_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 34
    #if (TSS_DETECT_EL_METHOD(34,TSI))
      #define TSS_E34_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 35
    #if (TSS_DETECT_EL_METHOD(35,TSI))
      #define TSS_E35_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 36
    #if (TSS_DETECT_EL_METHOD(36,TSI))
      #define TSS_E36_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 37
    #if (TSS_DETECT_EL_METHOD(37,TSI))
      #define TSS_E37_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 38
    #if (TSS_DETECT_EL_METHOD(38,TSI))
      #define TSS_E38_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 39
    #if (TSS_DETECT_EL_METHOD(39,TSI))
      #define TSS_E39_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 40
    #if (TSS_DETECT_EL_METHOD(40,TSI))
      #define TSS_E40_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 41
    #if (TSS_DETECT_EL_METHOD(41,TSI))
      #define TSS_E41_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 42
    #if (TSS_DETECT_EL_METHOD(42,TSI))
      #define TSS_E42_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 43
    #if (TSS_DETECT_EL_METHOD(43,TSI))
      #define TSS_E43_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 44
    #if (TSS_DETECT_EL_METHOD(44,TSI))
      #define TSS_E44_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 45
    #if (TSS_DETECT_EL_METHOD(45,TSI))
      #define TSS_E45_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 46
    #if (TSS_DETECT_EL_METHOD(46,TSI))
      #define TSS_E46_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 47
    #if (TSS_DETECT_EL_METHOD(47,TSI))
      #define TSS_E47_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 48
    #if (TSS_DETECT_EL_METHOD(48,TSI))
      #define TSS_E48_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 49
    #if (TSS_DETECT_EL_METHOD(49,TSI))
      #define TSS_E49_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 50
    #if (TSS_DETECT_EL_METHOD(50,TSI))
      #define TSS_E50_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 51
    #if (TSS_DETECT_EL_METHOD(51,TSI))
      #define TSS_E51_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 52
    #if (TSS_DETECT_EL_METHOD(52,TSI))
      #define TSS_E52_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 53
    #if (TSS_DETECT_EL_METHOD(53,TSI))
      #define TSS_E53_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 54
    #if (TSS_DETECT_EL_METHOD(54,TSI))
      #define TSS_E54_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 55
    #if (TSS_DETECT_EL_METHOD(55,TSI))
      #define TSS_E55_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 56
    #if (TSS_DETECT_EL_METHOD(56,TSI))
      #define TSS_E56_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 57
    #if (TSS_DETECT_EL_METHOD(57,TSI))
      #define TSS_E57_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 58
    #if (TSS_DETECT_EL_METHOD(58,TSI))
      #define TSS_E58_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 59
    #if (TSS_DETECT_EL_METHOD(59,TSI))
      #define TSS_E59_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 60
    #if (TSS_DETECT_EL_METHOD(60,TSI))
      #define TSS_E60_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 61
    #if (TSS_DETECT_EL_METHOD(61,TSI))
      #define TSS_E61_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 62
    #if (TSS_DETECT_EL_METHOD(62,TSI))
      #define TSS_E62_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif
  #if TSS_N_ELECTRODES > 63
    #if (TSS_DETECT_EL_METHOD(63,TSI))
      #define TSS_E63_SAMPLE_ELECTRODE()    TSI_SampleElectrode
    #endif
  #endif

  #if TSS_DETECT_METHOD(TSI)
      
    /*********************************************************************************
    *                    TSS_SystemSetup.h Back compatibility
    *********************************************************************************/
                
    #ifdef TSS_TSI_SCANC_EXTCHRG_LOW_LIMIT
      #ifndef TSS_TSI_EXTCHRG_LOW_LIMIT
        #define TSS_TSI_EXTCHRG_LOW_LIMIT      TSS_TSI_SCANC_EXTCHRG_LOW_LIMIT /* Low Limit of External OSC Charge Current value for TSI autocalibration */
      #endif  
    #endif
    #ifdef TSS_TSI_SCANC_EXTCHRG_HIGH_LIMIT
      #ifndef TSS_TSI_EXTCHRG_HIGH_LIMIT
        #define TSS_TSI_EXTCHRG_HIGH_LIMIT     TSS_TSI_SCANC_EXTCHRG_HIGH_LIMIT /* High Limit of External OSC Charge Current value for TSI autocalibration */
      #endif
    #endif
    #ifdef TSS_TSI_GENCS_PS_LOW_LIMIT
      #ifndef TSS_TSI_PS_LOW_LIMIT 
        #define TSS_TSI_PS_LOW_LIMIT           TSS_TSI_GENCS_PS_LOW_LIMIT /* Low Limit of External OSC Prescaler register value for TSI autocalibration */
      #endif
    #endif
    #ifdef TSS_TSI_GENCS_PS_HIGH_LIMIT
      #ifndef TSS_TSI_PS_HIGH_LIMIT
        #define TSS_TSI_PS_HIGH_LIMIT          TSS_TSI_GENCS_PS_HIGH_LIMIT /* High Limit of External OSC Prescaler register value for TSI autocalibration */
      #endif
    #endif
  
    /* Active Mode Clock Settings */
    #ifdef TSS_TSI_SCANC_AMCLKS
      #ifndef TSS_TSI_AMCLKS
        #define TSS_TSI_AMCLKS                 TSS_TSI_SCANC_AMCLKS /* Set Input Active Mode Clock Source ( 0 = BUSclk, 1 = MCGIRCLK, 2 = OSCERCLK, 3 - NA ) */
      #endif
    #endif
        
    #ifdef TSS_TSI_SCANC_AMPSC
      #ifndef TSS_TSI_AMPSC
        #define TSS_TSI_AMPSC                  TSS_TSI_SCANC_AMPSC /* Set Input Active Mode Clock Prescaler ( 0 = divide 1, 7 = divide 128 ) */
      #endif
    #endif
        
    #ifdef TSS_TSI_SCANC_AMCLKDIV
      #ifndef TSS_TSI_AMCLKDIV
        #define TSS_TSI_AMCLKDIV               TSS_TSI_SCANC_AMCLKDIV /* Set Input Active Mode Clock Divider ( 0 = divide 1, 1 = divide 2048 ) */
      #endif
    #endif
        
    /* Low Power TSI definition */
    #ifdef TSS_TSI_GENCS_LPCLKS
      #ifndef TSS_TSI_LPCLKS
        #define TSS_TSI_LPCLKS                 TSS_TSI_GENCS_LPCLKS /* Set Low Power Mode Clock Source ( 0 = LPOCLK, 1 = VLPOSCCLK ) */
      #endif
    #endif
        
    #ifdef TSS_TSI_DEF_SCANC_AMCLKS
      #ifndef TSS_TSI_AMCLKS      
        #define TSS_TSI_AMCLKS                 TSS_TSI_DEF_SCANC_AMCLKS
      #endif
    #endif
  
    #ifdef TSS_TSI_DEF_SCANC_AMCLKDIV
      #ifndef TSS_TSI_AMCLKDIV      
        #define TSS_TSI_AMCLKDIV               TSS_TSI_DEF_SCANC_AMCLKDIV
      #endif
    #endif
  
    #ifdef TSS_TSI_DEF_SCANC_AMPSC
      #ifndef TSS_TSI_AMPSC      
        #define TSS_TSI_AMPSC                  TSS_TSI_DEF_SCANC_AMPSC
      #endif
    #endif
  
    #ifdef TSS_TSI_DEF_GENCS_LPCLKS
      #ifndef TSS_TSI_LPCLKS      
        #define TSS_TSI_LPCLKS                 TSS_TSI_DEF_GENCS_LPCLKS
      #endif
    #endif

    /*********************************************************************************
    *                              TSI Specific Settings
    *********************************************************************************/
        
    /* TSI RefOSC definitions */
    #define TSS_TSI_SCANC_CAPTRM           5   /* Internal Capacitance Trim value 0=0.5pF, 5=1pF, 7=1.2pF */
    /* TSI RefOSC definitions */
    #define TSS_TSI_REFCHRG_FRQ            10  /* Required Frequency of Reference Internal Oscilator in MHz */
    /* TSI RefCHRG definitions */
    #define TSS_TSI_SCANC_REFCHRG          3  /* Ref OSC Charge Current */
    
    /* Electrode Default Threshold definition */
    #define TSS_TSI_DEFAULT_LOW_THRESHOLD  0      /* Low Threshold for the electrode */
    #define TSS_TSI_DEFAULT_HIGH_THRESHOLD 0xFFFF /* High Threshold for the electrode */
    /* TSI final calibration finding fault limit */
    #define TSI_FINAL_CALIB_FAULT_LIMIT    1
  
    /*** If not defined in TSS_SysteSetup.h then set default values ****/
    
    /* TSI Autocalibration Settings */
    #ifndef TSS_TSI_RESOLUTION
      #define TSS_TSI_RESOLUTION           11 /* Required Bit resolution of the TSI */
    #endif
    #ifndef TSS_TSI_EXTCHRG_LOW_LIMIT
      #define TSS_TSI_EXTCHRG_LOW_LIMIT    0 /* Low Limit of External OSC Charge Current value for TSI autocalibration */
    #endif
    #ifndef TSS_TSI_EXTCHRG_HIGH_LIMIT
    #if (TSS_TSI_VERSION==2)
      #define TSS_TSI_EXTCHRG_HIGH_LIMIT   15 /* High Limit of External OSC Charge Current value for TSI autocalibration */
    #elif (TSS_TSI_VERSION==3)
      #define TSS_TSI_EXTCHRG_HIGH_LIMIT   7 /* High Limit of External OSC Charge Current value for TSI autocalibration */
    #else
      #define TSS_TSI_EXTCHRG_HIGH_LIMIT   31 /* High Limit of External OSC Charge Current value for TSI autocalibration */
    #endif
    #endif
    #if (TSS_TSI_VERSION==1)
      #ifndef TSS_TSI_DELVOL
        #ifdef TSS_TSI_DVOLT
          #define TSS_TSI_DELVOL         TSS_TSI_DVOLT  /* Use value defined in TSS_SystemSetup.h */
        #else  
          #define TSS_TSI_DELVOL         7  /* Delta Voltage settings for ElOSC and RefOSC 0 = 100mV, 7 = 600mV */
        #endif  
      #endif
    #elif (TSS_TSI_VERSION == 3)
      #ifndef TSS_TSI_DVOLT
        #define TSS_TSI_DVOLT            0  /* The oscillator's voltage rails */
      #endif
    #endif
    #ifndef TSS_TSI_PS_LOW_LIMIT
      #define TSS_TSI_PS_LOW_LIMIT    0 /* Low Limit of External OSC Prescaler register value for TSI autocalibration */
    #endif
    #ifndef TSS_TSI_PS_HIGH_LIMIT
      #define TSS_TSI_PS_HIGH_LIMIT   7 /* High Limit of External OSC Prescaler register value for TSI autocalibration */
    #endif
    #ifndef TSS_TSI_PROX_RESOLUTION
      #define TSS_TSI_PROX_RESOLUTION           11 /* Required Bit resolution of the TSI */
    #endif
    #ifndef TSS_TSI_PROX_EXTCHRG_LOW_LIMIT
      #define TSS_TSI_PROX_EXTCHRG_LOW_LIMIT    0 /* Low Limit of External OSC Charge Current value for TSI autocalibration */
    #endif
    #ifndef TSS_TSI_PROX_EXTCHRG_HIGH_LIMIT
      #define TSS_TSI_PROX_EXTCHRG_HIGH_LIMIT   31 /* High Limit of External OSC Charge Current value for TSI autocalibration */
    #endif
    #ifndef TSS_TSI_PROX_PS_LOW_LIMIT
      #define TSS_TSI_PROX_PS_LOW_LIMIT    0 /* Low Limit of External OSC Prescaler register value for TSI autocalibration */
    #endif
    #ifndef TSS_TSI_PROX_PS_HIGH_LIMIT
      #define TSS_TSI_PROX_PS_HIGH_LIMIT   7 /* High Limit of External OSC Prescaler register value for TSI autocalibration */
    #endif
    /* Active Mode Clock Settings */
    #ifndef TSS_TSI_AMCLKS
      #define TSS_TSI_AMCLKS         0 /* Set Input Active Mode Clock Source ( 0 = BUSclk, 1 = MCGIRCLK, 2 = OSCERCLK, 3 - NA ) */
    #endif
    #ifndef TSS_TSI_AMPSC
      #define TSS_TSI_AMPSC          0 /* Set Input Active Mode Clock Prescaler ( 0 = divide 1, 7 = divide 128 ) */
    #endif
    #ifndef TSS_TSI_AMCLKDIV
      #define TSS_TSI_AMCLKDIV       1 /* Set Input Active Mode Clock Divider ( 0 = divide 1, 1 = divide 2048 ) */
    #endif
    /* Low Power TSI definition */
    #ifndef TSS_TSI_LPCLKS
      #define TSS_TSI_LPCLKS         0 /* Set Low Power Mode Clock Source ( 0 = LPOCLK, 1 = VLPOSCCLK ) */
    #endif
  
    /********************** Auto Calculated Settings *******************/

    /* Usable ranges for Recalibration */ 
    #define TSS_TSI_EXTCHRG_RANGE                  ((TSS_TSI_EXTCHRG_HIGH_LIMIT + 1u) - TSS_TSI_EXTCHRG_LOW_LIMIT) 
    #define TSS_TSI_PS_RANGE                       ((TSS_TSI_PS_HIGH_LIMIT + 1u) - TSS_TSI_PS_LOW_LIMIT) 
    #define TSS_TSI_PROX_EXTCHRG_RANGE             ((TSS_TSI_PROX_EXTCHRG_HIGH_LIMIT + 1u) - TSS_TSI_PROX_EXTCHRG_LOW_LIMIT) 
    #define TSS_TSI_PROX_PS_RANGE                  ((TSS_TSI_PROX_PS_HIGH_LIMIT + 1u) - TSS_TSI_PROX_PS_LOW_LIMIT) 
    /* TSI Resolution Value Determination */
    #define TSS_TSI_RESOLUTION_VALUE               (1 << (TSS_TSI_RESOLUTION - 1))
    #define TSS_TSI_PROX_RESOLUTION_VALUE          (1 << (TSS_TSI_PROX_RESOLUTION - 1))      
    /* Recalibration Thresholds */
    #define TSS_TSI_RECALIBRATION_LOW_THRESHOLD(resolution)           (UINT16)(((UINT32)(resolution)*13107) >> 16u) 
    #define TSS_TSI_RECALIBRATION_HIGH_THRESHOLD(resolution)          (0xFFFF-TSS_TSI_RECALIBRATION_HIGH_THRESHOLD_RANGE(resolution))    
    #define TSS_TSI_RECALIBRATION_HIGH_THRESHOLD_RANGE(resolution)    (UINT16)(((UINT32)(0xFFFF-resolution)*13107) >> 16u)   
    /* Fault Thresholds */
    #define TSS_TSI_CAP_LOW_LIMIT(resolution)                   (UINT16)(((UINT32)(resolution)*13107) >> 17u)                  
    #define TSS_TSI_CAP_HIGH_LIMIT(resolution)                  (0xFFFF-TSS_TSI_CAP_HIGH_LIMIT_RANGE(resolution)) 
    #define TSS_TSI_CAP_HIGH_LIMIT_RANGE(resolution)            (UINT16)(((UINT32)(0xFFFF-resolution)*13107) >> 17u)
      
    /*********************************************************************************
    *                          Validation of the Settings
    *********************************************************************************/
        
    #if (TSS_TSI_RESOLUTION < 1) || (TSS_TSI_RESOLUTION > 16) 
        #error "TSS - TSS_TSI_RESOLUTION is out of range"
    #endif
     
    #if (TSS_TSI_VERSION == 1) 
      #if (TSS_TSI_EXTCHRG_LOW_LIMIT  > 31)
        #error "TSS - TSS_TSI_EXTCHRG_LOW_LIMIT is out of range"
      #endif
    #elif (TSS_TSI_VERSION == 2)
      #if (TSS_TSI_EXTCHRG_LOW_LIMIT  > 15)
        #error "TSS - TSS_TSI_EXTCHRG_LOW_LIMIT is out of range"
      #endif
    #elif (TSS_TSI_VERSION == 3)
      #if (TSS_TSI_EXTCHRG_LOW_LIMIT  > 7)
        #error "TSS - TSS_TSI_EXTCHRG_LOW_LIMIT is out of range"
      #endif
    #endif

    #if (TSS_TSI_VERSION == 1) 
      #if (TSS_TSI_EXTCHRG_HIGH_LIMIT > 31)
        #error "TSS - TSS_TSI_EXTCHRG_HIGH_LIMIT is out of range"
      #endif
    #elif (TSS_TSI_VERSION == 2)
      #if (TSS_TSI_EXTCHRG_HIGH_LIMIT > 15)
        #error "TSS - TSS_TSI_EXTCHRG_HIGH_LIMIT is out of range"
      #endif
    #elif (TSS_TSI_VERSION == 3)
      #if (TSS_TSI_EXTCHRG_HIGH_LIMIT > 7)
        #error "TSS - TSS_TSI_EXTCHRG_HIGH_LIMIT is out of range"
      #endif
    #endif
      
    #if (TSS_TSI_EXTCHRG_LOW_LIMIT > TSS_TSI_EXTCHRG_HIGH_LIMIT)
        #error "TSS - TSS_TSI_EXTCHRG_LOW_LIMIT may not be higher than TSS_TSI_EXTCHRG_HIGH_LIMIT"
    #endif
      
    #if (TSS_TSI_VERSION == 1)
      #if (TSS_TSI_DELVOL > 7)
        #error "TSS - TSS_TSI_DELVOL is out of range"
      #endif 
    #endif
    
    #if (TSS_TSI_VERSION == 3)
      #if (TSS_TSI_DVOLT > 3)
        #error "TSS - TSS_TSI_DVOLT is out of range"
      #endif 
    #endif
    
    #if (TSS_TSI_PS_LOW_LIMIT  > 7)
        #error "TSS - TSS_TSI_PS_LOW_LIMIT is out of range"
    #endif
        
    #if (TSS_TSI_PS_HIGH_LIMIT > 7)
        #error "TSS - TSS_TSI_PS_HIGH_LIMIT is out of range"
    #endif
        
    #if (TSS_TSI_PS_LOW_LIMIT > TSS_TSI_PS_HIGH_LIMIT)
        #error "TSS - TSS_TSI_PS_LOW_LIMIT may not be higher than TSS_TSI_PS_HIGH_LIMIT"
    #endif
        
    #if (TSS_TSI_AMCLKS > 2)
        #error "TSS - TSS_TSI_AMCLKS is set to invalid value"
    #endif
        
    #if (TSS_TSI_AMPSC > 7)
        #error "TSS - TSS_TSI_AMPSC is set to invalid value"
    #endif
        
    #if (TSS_TSI_AMCLKDIV > 1)
        #error "TSS - TSS_TSI_AMCLKDIV is set to invalid value"
    #endif
        
    #if (TSS_TSI_LPCLKS > 1)
        #error "TSS - TSS_TSI_LPCLKS is set to invalid value"
    #endif
  
    #if (TSS_AUTOTRIGGER_SOURCE_USED && TSS_USE_TRIGGER_FUNCTION)
      #if (TSS_DETECT_AUTOTRIGGER_SOURCE_USAGE(TSI) || TSS_DETECT_AUTOTRIGGER_SOURCE_USAGE(TSI0) || TSS_DETECT_AUTOTRIGGER_SOURCE_USAGE(TSI1))
        #if TSS_DETECT_AUTOTRIGGER_SOURCE_USAGE(TSI)
          #if !TSS_DETECT_MODULE(TSI)
            #error "TSS - TSS_USE_AUTOTRIGGER_SOURCE is set to invalid value. TSI module is not used in the TSS."
          #endif
        #endif
        #if TSS_DETECT_AUTOTRIGGER_SOURCE_USAGE(TSI0)
          #if !TSS_DETECT_MODULE(TSI0)
            #error "TSS - TSS_USE_AUTOTRIGGER_SOURCE is set to invalid value. TSI0 module is not used in the TSS."
          #endif
        #endif
        #if TSS_DETECT_AUTOTRIGGER_SOURCE_USAGE(TSI1)
          #if !TSS_DETECT_MODULE(TSI1)
            #error "TSS - TSS_USE_AUTOTRIGGER_SOURCE is set to invalid value. TSI1 module is not used in the TSS."
          #endif
        #endif
      #else
        #error "TSS - TSS_USE_AUTOTRIGGER_SOURCE is set to invalid value."
      #endif
    #endif
    
    #if (TSS_LOWPOWER_USED)
      #if (TSS_DETECT_LOWPOWER_USAGE(TSI) || TSS_DETECT_LOWPOWER_USAGE(TSI0) || TSS_DETECT_LOWPOWER_USAGE(TSI1))
        #if TSS_DETECT_LOWPOWER_USAGE(TSI)
          #if !TSS_DETECT_MODULE(TSI)
            #error "TSS - TSS_USE_LOWPOWER_CONTROL_SOURCE is set to invalid value. TSI module is not used in the TSS."
          #endif
        #endif
        #if TSS_DETECT_LOWPOWER_USAGE(TSI0)
          #if !TSS_DETECT_MODULE(TSI0)
            #error "TSS - TSS_USE_LOWPOWER_CONTROL_SOURCE is set to invalid value. TSI0 module is not used in the TSS."
          #endif
        #endif
        #if TSS_DETECT_LOWPOWER_USAGE(TSI1)
          #if !TSS_DETECT_MODULE(TSI1)
            #error "TSS - TSS_USE_LOWPOWER_CONTROL_SOURCE is set to invalid value. TSI1 module is not used in the TSS."
          #endif
        #endif
      #else      
        #error "TSS - TSS_USE_LOWPOWER_CONTROL_SOURCE is set to invalid value."
      #endif
    #endif
  
    /*********************************************************************************
    *                      TSI Module Name Recognition Macros
    *********************************************************************************/
  
    #define TSS_TSICH0_TSI_MODULE_NAME            TSI
    #define TSS_TSICH1_TSI_MODULE_NAME            TSI
    #define TSS_TSICH2_TSI_MODULE_NAME            TSI
    #define TSS_TSICH3_TSI_MODULE_NAME            TSI
    #define TSS_TSICH4_TSI_MODULE_NAME            TSI
    #define TSS_TSICH5_TSI_MODULE_NAME            TSI
    #define TSS_TSICH6_TSI_MODULE_NAME            TSI
    #define TSS_TSICH7_TSI_MODULE_NAME            TSI
    #define TSS_TSICH8_TSI_MODULE_NAME            TSI
    #define TSS_TSICH9_TSI_MODULE_NAME            TSI
    #define TSS_TSICH10_TSI_MODULE_NAME           TSI
    #define TSS_TSICH11_TSI_MODULE_NAME           TSI
    #define TSS_TSICH12_TSI_MODULE_NAME           TSI
    #define TSS_TSICH13_TSI_MODULE_NAME           TSI
    #define TSS_TSICH14_TSI_MODULE_NAME           TSI
    #define TSS_TSICH15_TSI_MODULE_NAME           TSI
  
    #define TSS_TSI0CH0_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0CH1_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0CH2_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0CH3_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0CH4_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0CH5_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0CH6_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0CH7_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0CH8_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0CH9_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0CH10_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0CH11_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0CH12_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0CH13_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0CH14_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0CH15_TSI_MODULE_NAME          TSI0
  
    #define TSS_TSI1CH0_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1CH1_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1CH2_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1CH3_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1CH4_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1CH5_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1CH6_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1CH7_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1CH8_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1CH9_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1CH10_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1CH11_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1CH12_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1CH13_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1CH14_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1CH15_TSI_MODULE_NAME          TSI1
  
  
    #define TSS_TSI_CH0_TSI_MODULE_NAME           TSI
    #define TSS_TSI_CH1_TSI_MODULE_NAME           TSI
    #define TSS_TSI_CH2_TSI_MODULE_NAME           TSI
    #define TSS_TSI_CH3_TSI_MODULE_NAME           TSI
    #define TSS_TSI_CH4_TSI_MODULE_NAME           TSI
    #define TSS_TSI_CH5_TSI_MODULE_NAME           TSI
    #define TSS_TSI_CH6_TSI_MODULE_NAME           TSI
    #define TSS_TSI_CH7_TSI_MODULE_NAME           TSI
    #define TSS_TSI_CH8_TSI_MODULE_NAME           TSI
    #define TSS_TSI_CH9_TSI_MODULE_NAME           TSI
    #define TSS_TSI_CH10_TSI_MODULE_NAME          TSI
    #define TSS_TSI_CH11_TSI_MODULE_NAME          TSI
    #define TSS_TSI_CH12_TSI_MODULE_NAME          TSI
    #define TSS_TSI_CH13_TSI_MODULE_NAME          TSI
    #define TSS_TSI_CH14_TSI_MODULE_NAME          TSI
    #define TSS_TSI_CH15_TSI_MODULE_NAME          TSI
  
    #define TSS_TSI0_CH0_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_CH1_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_CH2_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_CH3_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_CH4_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_CH5_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_CH6_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_CH7_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_CH8_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_CH9_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_CH10_TSI_MODULE_NAME         TSI0
    #define TSS_TSI0_CH11_TSI_MODULE_NAME         TSI0
    #define TSS_TSI0_CH12_TSI_MODULE_NAME         TSI0
    #define TSS_TSI0_CH13_TSI_MODULE_NAME         TSI0
    #define TSS_TSI0_CH14_TSI_MODULE_NAME         TSI0
    #define TSS_TSI0_CH15_TSI_MODULE_NAME         TSI0
  
    #define TSS_TSI1_CH0_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_CH1_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_CH2_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_CH3_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_CH4_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_CH5_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_CH6_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_CH7_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_CH8_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_CH9_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_CH10_TSI_MODULE_NAME         TSI1
    #define TSS_TSI1_CH11_TSI_MODULE_NAME         TSI1
    #define TSS_TSI1_CH12_TSI_MODULE_NAME         TSI1
    #define TSS_TSI1_CH13_TSI_MODULE_NAME         TSI1
    #define TSS_TSI1_CH14_TSI_MODULE_NAME         TSI1
    #define TSS_TSI1_CH15_TSI_MODULE_NAME         TSI1
    
    
    #define TSS_TSIIN0_TSI_MODULE_NAME            TSI
    #define TSS_TSIIN1_TSI_MODULE_NAME            TSI
    #define TSS_TSIIN2_TSI_MODULE_NAME            TSI
    #define TSS_TSIIN3_TSI_MODULE_NAME            TSI
    #define TSS_TSIIN4_TSI_MODULE_NAME            TSI
    #define TSS_TSIIN5_TSI_MODULE_NAME            TSI
    #define TSS_TSIIN6_TSI_MODULE_NAME            TSI
    #define TSS_TSIIN7_TSI_MODULE_NAME            TSI
    #define TSS_TSIIN8_TSI_MODULE_NAME            TSI
    #define TSS_TSIIN9_TSI_MODULE_NAME            TSI
    #define TSS_TSIIN10_TSI_MODULE_NAME           TSI
    #define TSS_TSIIN11_TSI_MODULE_NAME           TSI
    #define TSS_TSIIN12_TSI_MODULE_NAME           TSI
    #define TSS_TSIIN13_TSI_MODULE_NAME           TSI
    #define TSS_TSIIN14_TSI_MODULE_NAME           TSI
    #define TSS_TSIIN15_TSI_MODULE_NAME           TSI
  
    #define TSS_TSI0IN0_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0IN1_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0IN2_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0IN3_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0IN4_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0IN5_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0IN6_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0IN7_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0IN8_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0IN9_TSI_MODULE_NAME           TSI0
    #define TSS_TSI0IN10_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0IN11_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0IN12_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0IN13_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0IN14_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0IN15_TSI_MODULE_NAME          TSI0
  
    #define TSS_TSI1IN0_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1IN1_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1IN2_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1IN3_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1IN4_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1IN5_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1IN6_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1IN7_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1IN8_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1IN9_TSI_MODULE_NAME           TSI1
    #define TSS_TSI1IN10_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1IN11_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1IN12_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1IN13_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1IN14_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1IN15_TSI_MODULE_NAME          TSI1
  
  
    #define TSS_TSI_IN0_TSI_MODULE_NAME           TSI
    #define TSS_TSI_IN1_TSI_MODULE_NAME           TSI
    #define TSS_TSI_IN2_TSI_MODULE_NAME           TSI
    #define TSS_TSI_IN3_TSI_MODULE_NAME           TSI
    #define TSS_TSI_IN4_TSI_MODULE_NAME           TSI
    #define TSS_TSI_IN5_TSI_MODULE_NAME           TSI
    #define TSS_TSI_IN6_TSI_MODULE_NAME           TSI
    #define TSS_TSI_IN7_TSI_MODULE_NAME           TSI
    #define TSS_TSI_IN8_TSI_MODULE_NAME           TSI
    #define TSS_TSI_IN9_TSI_MODULE_NAME           TSI
    #define TSS_TSI_IN10_TSI_MODULE_NAME          TSI
    #define TSS_TSI_IN11_TSI_MODULE_NAME          TSI
    #define TSS_TSI_IN12_TSI_MODULE_NAME          TSI
    #define TSS_TSI_IN13_TSI_MODULE_NAME          TSI
    #define TSS_TSI_IN14_TSI_MODULE_NAME          TSI
    #define TSS_TSI_IN15_TSI_MODULE_NAME          TSI
  
    #define TSS_TSI0_IN0_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_IN1_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_IN2_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_IN3_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_IN4_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_IN5_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_IN6_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_IN7_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_IN8_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_IN9_TSI_MODULE_NAME          TSI0
    #define TSS_TSI0_IN10_TSI_MODULE_NAME         TSI0
    #define TSS_TSI0_IN11_TSI_MODULE_NAME         TSI0
    #define TSS_TSI0_IN12_TSI_MODULE_NAME         TSI0
    #define TSS_TSI0_IN13_TSI_MODULE_NAME         TSI0
    #define TSS_TSI0_IN14_TSI_MODULE_NAME         TSI0
    #define TSS_TSI0_IN15_TSI_MODULE_NAME         TSI0
  
    #define TSS_TSI1_IN0_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_IN1_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_IN2_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_IN3_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_IN4_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_IN5_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_IN6_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_IN7_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_IN8_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_IN9_TSI_MODULE_NAME          TSI1
    #define TSS_TSI1_IN10_TSI_MODULE_NAME         TSI1
    #define TSS_TSI1_IN11_TSI_MODULE_NAME         TSI1
    #define TSS_TSI1_IN12_TSI_MODULE_NAME         TSI1
    #define TSS_TSI1_IN13_TSI_MODULE_NAME         TSI1
    #define TSS_TSI1_IN14_TSI_MODULE_NAME         TSI1
    #define TSS_TSI1_IN15_TSI_MODULE_NAME         TSI1
  
    #define TSS_TSI_MODULE_NAME_RESULT(res)       TSS_##res##_TSI_MODULE_NAME
    #define TSS_TSI_MODULE_NAME_CONV(text)        TSS_TSI_MODULE_NAME_RESULT(text)
    #define TSS_TSI_MODULE_NAME(elec)             TSS_TSI_MODULE_NAME_CONV(elec)
  
    #define TSS_TSI_EL_MODULE_NAME(el)            TSS_TSI_MODULE_NAME(TSS_E##el##_TYPE)
  
    /*********************************************************************************
    *                               TSI Channel Macros
    *********************************************************************************/
  
    #define TSS_TSICH0_PEN_SHIFT              0
    #define TSS_TSICH1_PEN_SHIFT              1
    #define TSS_TSICH2_PEN_SHIFT              2
    #define TSS_TSICH3_PEN_SHIFT              3
    #define TSS_TSICH4_PEN_SHIFT              4
    #define TSS_TSICH5_PEN_SHIFT              5
    #define TSS_TSICH6_PEN_SHIFT              6
    #define TSS_TSICH7_PEN_SHIFT              7
    #define TSS_TSICH8_PEN_SHIFT              8
    #define TSS_TSICH9_PEN_SHIFT              9
    #define TSS_TSICH10_PEN_SHIFT             10
    #define TSS_TSICH11_PEN_SHIFT             11
    #define TSS_TSICH12_PEN_SHIFT             12
    #define TSS_TSICH13_PEN_SHIFT             13
    #define TSS_TSICH14_PEN_SHIFT             14
    #define TSS_TSICH15_PEN_SHIFT             15
    
    #define TSS_TSI0CH0_PEN_SHIFT             0
    #define TSS_TSI0CH1_PEN_SHIFT             1
    #define TSS_TSI0CH2_PEN_SHIFT             2
    #define TSS_TSI0CH3_PEN_SHIFT             3
    #define TSS_TSI0CH4_PEN_SHIFT             4
    #define TSS_TSI0CH5_PEN_SHIFT             5
    #define TSS_TSI0CH6_PEN_SHIFT             6
    #define TSS_TSI0CH7_PEN_SHIFT             7
    #define TSS_TSI0CH8_PEN_SHIFT             8
    #define TSS_TSI0CH9_PEN_SHIFT             9
    #define TSS_TSI0CH10_PEN_SHIFT            10
    #define TSS_TSI0CH11_PEN_SHIFT            11
    #define TSS_TSI0CH12_PEN_SHIFT            12
    #define TSS_TSI0CH13_PEN_SHIFT            13
    #define TSS_TSI0CH14_PEN_SHIFT            14
    #define TSS_TSI0CH15_PEN_SHIFT            15
    
    #define TSS_TSI1CH0_PEN_SHIFT             0
    #define TSS_TSI1CH1_PEN_SHIFT             1
    #define TSS_TSI1CH2_PEN_SHIFT             2
    #define TSS_TSI1CH3_PEN_SHIFT             3
    #define TSS_TSI1CH4_PEN_SHIFT             4
    #define TSS_TSI1CH5_PEN_SHIFT             5
    #define TSS_TSI1CH6_PEN_SHIFT             6
    #define TSS_TSI1CH7_PEN_SHIFT             7
    #define TSS_TSI1CH8_PEN_SHIFT             8
    #define TSS_TSI1CH9_PEN_SHIFT             9
    #define TSS_TSI1CH10_PEN_SHIFT            10
    #define TSS_TSI1CH11_PEN_SHIFT            11
    #define TSS_TSI1CH12_PEN_SHIFT            12
    #define TSS_TSI1CH13_PEN_SHIFT            13
    #define TSS_TSI1CH14_PEN_SHIFT            14
    #define TSS_TSI1CH15_PEN_SHIFT            15
    
    
    #define TSS_TSI_CH0_PEN_SHIFT             0
    #define TSS_TSI_CH1_PEN_SHIFT             1
    #define TSS_TSI_CH2_PEN_SHIFT             2
    #define TSS_TSI_CH3_PEN_SHIFT             3 
    #define TSS_TSI_CH4_PEN_SHIFT             4
    #define TSS_TSI_CH5_PEN_SHIFT             5
    #define TSS_TSI_CH6_PEN_SHIFT             6
    #define TSS_TSI_CH7_PEN_SHIFT             7
    #define TSS_TSI_CH8_PEN_SHIFT             8
    #define TSS_TSI_CH9_PEN_SHIFT             9
    #define TSS_TSI_CH10_PEN_SHIFT            10
    #define TSS_TSI_CH11_PEN_SHIFT            11
    #define TSS_TSI_CH12_PEN_SHIFT            12
    #define TSS_TSI_CH13_PEN_SHIFT            13
    #define TSS_TSI_CH14_PEN_SHIFT            14
    #define TSS_TSI_CH15_PEN_SHIFT            15
    
    #define TSS_TSI0_CH0_PEN_SHIFT            0
    #define TSS_TSI0_CH1_PEN_SHIFT            1
    #define TSS_TSI0_CH2_PEN_SHIFT            2
    #define TSS_TSI0_CH3_PEN_SHIFT            3
    #define TSS_TSI0_CH4_PEN_SHIFT            4
    #define TSS_TSI0_CH5_PEN_SHIFT            5 
    #define TSS_TSI0_CH6_PEN_SHIFT            6
    #define TSS_TSI0_CH7_PEN_SHIFT            7
    #define TSS_TSI0_CH8_PEN_SHIFT            8
    #define TSS_TSI0_CH9_PEN_SHIFT            9
    #define TSS_TSI0_CH10_PEN_SHIFT           10
    #define TSS_TSI0_CH11_PEN_SHIFT           11
    #define TSS_TSI0_CH12_PEN_SHIFT           12
    #define TSS_TSI0_CH13_PEN_SHIFT           13
    #define TSS_TSI0_CH14_PEN_SHIFT           14
    #define TSS_TSI0_CH15_PEN_SHIFT           15
    
    #define TSS_TSI1_CH0_PEN_SHIFT            0
    #define TSS_TSI1_CH1_PEN_SHIFT            1
    #define TSS_TSI1_CH2_PEN_SHIFT            2
    #define TSS_TSI1_CH3_PEN_SHIFT            3
    #define TSS_TSI1_CH4_PEN_SHIFT            4
    #define TSS_TSI1_CH5_PEN_SHIFT            5
    #define TSS_TSI1_CH6_PEN_SHIFT            6
    #define TSS_TSI1_CH7_PEN_SHIFT            7
    #define TSS_TSI1_CH8_PEN_SHIFT            8
    #define TSS_TSI1_CH9_PEN_SHIFT            9
    #define TSS_TSI1_CH10_PEN_SHIFT           10
    #define TSS_TSI1_CH11_PEN_SHIFT           11
    #define TSS_TSI1_CH12_PEN_SHIFT           12
    #define TSS_TSI1_CH13_PEN_SHIFT           13
    #define TSS_TSI1_CH14_PEN_SHIFT           14
    #define TSS_TSI1_CH15_PEN_SHIFT           15
    
    
    #define TSS_TSIIN0_PEN_SHIFT              0
    #define TSS_TSIIN1_PEN_SHIFT              1
    #define TSS_TSIIN2_PEN_SHIFT              2
    #define TSS_TSIIN3_PEN_SHIFT              3
    #define TSS_TSIIN4_PEN_SHIFT              4
    #define TSS_TSIIN5_PEN_SHIFT              5
    #define TSS_TSIIN6_PEN_SHIFT              6
    #define TSS_TSIIN7_PEN_SHIFT              7
    #define TSS_TSIIN8_PEN_SHIFT              8
    #define TSS_TSIIN9_PEN_SHIFT              9
    #define TSS_TSIIN10_PEN_SHIFT             10
    #define TSS_TSIIN11_PEN_SHIFT             11
    #define TSS_TSIIN12_PEN_SHIFT             12
    #define TSS_TSIIN13_PEN_SHIFT             13
    #define TSS_TSIIN14_PEN_SHIFT             14
    #define TSS_TSIIN15_PEN_SHIFT             15
    
    #define TSS_TSI0IN0_PEN_SHIFT             0
    #define TSS_TSI0IN1_PEN_SHIFT             1
    #define TSS_TSI0IN2_PEN_SHIFT             2
    #define TSS_TSI0IN3_PEN_SHIFT             3
    #define TSS_TSI0IN4_PEN_SHIFT             4
    #define TSS_TSI0IN5_PEN_SHIFT             5
    #define TSS_TSI0IN6_PEN_SHIFT             6
    #define TSS_TSI0IN7_PEN_SHIFT             7
    #define TSS_TSI0IN8_PEN_SHIFT             8
    #define TSS_TSI0IN9_PEN_SHIFT             9
    #define TSS_TSI0IN10_PEN_SHIFT            10
    #define TSS_TSI0IN11_PEN_SHIFT            11
    #define TSS_TSI0IN12_PEN_SHIFT            12
    #define TSS_TSI0IN13_PEN_SHIFT            13
    #define TSS_TSI0IN14_PEN_SHIFT            14
    #define TSS_TSI0IN15_PEN_SHIFT            15
    
    #define TSS_TSI1IN0_PEN_SHIFT             0
    #define TSS_TSI1IN1_PEN_SHIFT             1
    #define TSS_TSI1IN2_PEN_SHIFT             2
    #define TSS_TSI1IN3_PEN_SHIFT             3
    #define TSS_TSI1IN4_PEN_SHIFT             4
    #define TSS_TSI1IN5_PEN_SHIFT             5
    #define TSS_TSI1IN6_PEN_SHIFT             6
    #define TSS_TSI1IN7_PEN_SHIFT             7
    #define TSS_TSI1IN8_PEN_SHIFT             8
    #define TSS_TSI1IN9_PEN_SHIFT             9
    #define TSS_TSI1IN10_PEN_SHIFT            10
    #define TSS_TSI1IN11_PEN_SHIFT            11
    #define TSS_TSI1IN12_PEN_SHIFT            12
    #define TSS_TSI1IN13_PEN_SHIFT            13
    #define TSS_TSI1IN14_PEN_SHIFT            14
    #define TSS_TSI1IN15_PEN_SHIFT            15
    
    
    #define TSS_TSI_IN0_PEN_SHIFT             0
    #define TSS_TSI_IN1_PEN_SHIFT             1
    #define TSS_TSI_IN2_PEN_SHIFT             2
    #define TSS_TSI_IN3_PEN_SHIFT             3 
    #define TSS_TSI_IN4_PEN_SHIFT             4
    #define TSS_TSI_IN5_PEN_SHIFT             5
    #define TSS_TSI_IN6_PEN_SHIFT             6
    #define TSS_TSI_IN7_PEN_SHIFT             7
    #define TSS_TSI_IN8_PEN_SHIFT             8
    #define TSS_TSI_IN9_PEN_SHIFT             9
    #define TSS_TSI_IN10_PEN_SHIFT            10
    #define TSS_TSI_IN11_PEN_SHIFT            11
    #define TSS_TSI_IN12_PEN_SHIFT            12
    #define TSS_TSI_IN13_PEN_SHIFT            13
    #define TSS_TSI_IN14_PEN_SHIFT            14
    #define TSS_TSI_IN15_PEN_SHIFT            15
    
    #define TSS_TSI0_IN0_PEN_SHIFT            0
    #define TSS_TSI0_IN1_PEN_SHIFT            1
    #define TSS_TSI0_IN2_PEN_SHIFT            2
    #define TSS_TSI0_IN3_PEN_SHIFT            3
    #define TSS_TSI0_IN4_PEN_SHIFT            4
    #define TSS_TSI0_IN5_PEN_SHIFT            5 
    #define TSS_TSI0_IN6_PEN_SHIFT            6
    #define TSS_TSI0_IN7_PEN_SHIFT            7
    #define TSS_TSI0_IN8_PEN_SHIFT            8
    #define TSS_TSI0_IN9_PEN_SHIFT            9
    #define TSS_TSI0_IN10_PEN_SHIFT           10
    #define TSS_TSI0_IN11_PEN_SHIFT           11
    #define TSS_TSI0_IN12_PEN_SHIFT           12
    #define TSS_TSI0_IN13_PEN_SHIFT           13
    #define TSS_TSI0_IN14_PEN_SHIFT           14
    #define TSS_TSI0_IN15_PEN_SHIFT           15
    
    #define TSS_TSI1_IN0_PEN_SHIFT            0
    #define TSS_TSI1_IN1_PEN_SHIFT            1
    #define TSS_TSI1_IN2_PEN_SHIFT            2
    #define TSS_TSI1_IN3_PEN_SHIFT            3
    #define TSS_TSI1_IN4_PEN_SHIFT            4
    #define TSS_TSI1_IN5_PEN_SHIFT            5
    #define TSS_TSI1_IN6_PEN_SHIFT            6
    #define TSS_TSI1_IN7_PEN_SHIFT            7
    #define TSS_TSI1_IN8_PEN_SHIFT            8
    #define TSS_TSI1_IN9_PEN_SHIFT            9
    #define TSS_TSI1_IN10_PEN_SHIFT           10
    #define TSS_TSI1_IN11_PEN_SHIFT           11
    #define TSS_TSI1_IN12_PEN_SHIFT           12
    #define TSS_TSI1_IN13_PEN_SHIFT           13
    #define TSS_TSI1_IN14_PEN_SHIFT           14
    #define TSS_TSI1_IN15_PEN_SHIFT           15
  
    #define TSS_TSI_GET_EL_PEN_TO_REG(reg)    TSS_##reg##_PEN_SHIFT
    #define TSS_TSI_GET_EL_PEN(name)          TSS_TSI_GET_EL_PEN_TO_REG(name)
  
    #define TSS_TSI_EL_CHANNEL_MASK(el)       1 << TSS_TSI_GET_EL_PEN(TSS_E##el##_TYPE)
    #define TSS_TSI_EL_CHANNEL_NUM(el)        TSS_TSI_GET_EL_PEN(TSS_E##el##_TYPE)
  
    #if (TSS_TSI_VERSION == 1)
      #define TSS_CALC_TSI_REFCHRG_TABLE        ((u8RefChrgCalcTable[TSS_TSI_SCANC_CAPTRM][TSS_TSI_DELVOL]*TSS_TSI_REFCHRG_FRQ/100) > 0) ? (u8RefChrgCalcTable[TSS_TSI_SCANC_CAPTRM][TSS_TSI_DELVOL]*TSS_TSI_REFCHRG_FRQ/100)-1 : (u8RefChrgCalcTable[TSS_TSI_SCANC_CAPTRM][TSS_TSI_DELVOL]*TSS_TSI_REFCHRG_FRQ/100)
    #endif
    /*********************************************************************************
    *                    Derivative Headers Compatibility Macros
    *********************************************************************************/
      
    #ifndef TSI_GENCS_LPCLKS
      #define TSI_GENCS_LPCLKS(x)             (((x)<<TSI_GENCS_LPCLKS_SHIFT)&TSI_GENCS_LPCLKS_MASK)
    #endif
  
    #ifndef TSI_SCANC_AMCLKDIV
      #define TSI_SCANC_AMCLKDIV(x)           (((x)<<TSI_SCANC_AMCLKDIV_SHIFT)&TSI_SCANC_AMCLKDIV_MASK)
    #endif
    
    #ifndef TSI_THRESHOLD_HTHH
      #define TSI_THRESHOLD_HTHH              TSI_THRESHLD_HTHH
    #endif
  
    #ifndef TSI_THRESHOLD_LTHH
      #define TSI_THRESHOLD_LTHH              TSI_THRESHLD_LTHH
    #endif
  
    #if TSS_CFM_MCU
      #ifdef TSI0_BASE_PTR
        #ifndef TSI_BASE_PTR
          #define TSI_BASE_PTR                TSI0_BASE_PTR
        #endif
      #endif
    #endif

#endif /* End of #if TSS_DETECT_METHOD(TSI) */

#endif /* TSS_SENSORTSI_H */
